#ifndef __triac_h
#define __triac_h

//Hal------------------
#define F_triacOn()   P3_4 = 0
#define F_triacOff()  P3_4 = 1
#define D_crossZero   P3_7 
//Const-----------------
#define D_triacHoldTime   6 //base 0.125ms 
#define D_watt 6
#define D_0W 0
#define D_50W 1
#define D_100W 2
#define D_150W 3
#define D_200W 4
#define D_250W 5
#define D_300W 6
// #define D_400W 8
// #define D_500W 10
// #define D_600W 12
// #define D_700W 14
// #define D_800W 16
// //Var-----------------
	#ifdef __triac_c
	uint8_t holdWatt;
		uint8_t TriacLastTimer;
		bit bLastZero ;
		bit bZero ;
	//	bit bDelay ;
		bit bWattSetted ;
	//	bit	bAlarm ;	
	uint8_t holdFireType;
		uint8_t fireType ;
		uint8_t triacTimer  ;
		//uint8_t zeroCounter ;
	#else
		extern uint8_t holdFireType;
		extern 	uint8_t holdWatt;
		extern 	uint8_t TriacLastTimer;

		extern bit bLastZero ;
		extern bit bZero ;
		//extern bit bDelay ;
		extern bit bWattSetted ;
		//extern bit	bAlarm ;
		extern uint8_t fireType ;
		extern uint8_t triacTimer  ;	
		//extern uint8_t zeroCounter ;
	#endif
//Function-------------------
void InitTriac() ;


#endif
